package router

import (
	"6-5zk/client/client"
	"6-5zk/client/requset"
	"6-5zk/client/response"
	"6-5zk/common/proto/user"
	"github.com/gin-gonic/gin"
)

func TakeFoodList(c *gin.Context) {
	list, err := client.TakeFoodList(c, &user.TakeFoodListReq{})
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	response.ResponseSuccess(c, list)
}

func NoticeCreate(c *gin.Context) {
	var data requset.NoticeCreate
	err := c.ShouldBind(&data)
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	create, err := client.NoticeCreate(c, &user.NoticeCreateReq{
		NoticeStatus: int64(data.NoticeStatus),
		Client:       int64(data.Client),
		Title:        data.Title,
		Content:      data.Content,
		Connect:      data.Connect,
		Image:        data.Image,
	})
	if err != nil {
		response.ResponseError(c, err.Error())
		return
	}
	response.ResponseSuccess(c, create)
}
